package com.ydl.zhwc.mvpandrxjava.sample.mvp;

import com.ydl.zhwc.mvpandrxjava.bean.Now;
import com.ydl.zhwc.mvpandrxjava.sample.RxUtils;
import com.ydl.zhwc.mvpandrxjava.sample.http.ApiProvider;
import com.ydl.zhwc.mvpandrxjava.sample.http.ApiService;

import io.reactivex.Observable;
import io.reactivex.schedulers.Schedulers;

/**
 * author : Zhangwenchao
 * e-mail : zhangwch@yidianling.com
 * time   : 2017/12/22
 */

public class MVPModel implements MVPContract.Model {

    @Override
    public Observable<Now> getNow() {
        return ApiProvider.getApiService()
                .rxWeather(ApiService.KEY, "hangzhou")
                .subscribeOn(Schedulers.io())
                .compose(RxUtils.handlerThrowable());
    }
}
